package com.link.play.fit.ai.ui.setting

import android.os.Bundle
import android.widget.Toast
import androidx.activity.addCallback
import androidx.core.widget.addTextChangedListener
import com.link.play.fit.ai.R
import com.link.play.fit.ai.base.BaseActivity
import com.link.play.fit.ai.databinding.AcFeedbackBinding
import com.link.play.fit.ai.utils.EventUtils

class FeedbackAc : BaseActivity<AcFeedbackBinding>(AcFeedbackBinding::inflate) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setStatusBarColor(getColor(R.color.colorPrimary))
        binding.flBack.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
        onBackPressedDispatcher.addCallback {
            finish()
        }

        binding.edit.addTextChangedListener {
            binding.tvBtn.isEnabled = it?.isNotEmpty() == true
        }

        binding.tvBtn.setOnClickListener {
            EventUtils.event("Feedback", "${binding.edit.text?.toString()}")
            Toast.makeText(this, "Thanks Feedback!", Toast.LENGTH_SHORT).show()
            finish()
        }
    }

}